#include <stdio.h>

#define SIZE 3
#define PAR 72

/**
 * 本例是演示int数组
*/
int main(void)
{
    int index, score[SIZE];
    int sum = 0;
    float average;
    printf("Enter %d golf scores:\n", SIZE);
    for (index = 0; index < SIZE; index++)
    {
        // 这里必须按照规矩来输入，假如输入一个85.0，会导致错误，也许以后会学到有办法可以解决
        scanf("%d", &score[index]);
    }
    printf("the scores read in are as follows:\n");
    for ( index = 0; index < SIZE; index++)
    {
        printf("%5d", score[index]);
    }
    putchar('\n');
    for (index = 0; index < SIZE; index++)
    {
        sum += score[index];
    }
    average = (float) sum / SIZE;
    printf("Sum of scores = %d, average = %.2f\n", sum, average);
    printf("That's a handicap of %0.f.\n", average - PAR);
    return 0;
}